package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.DevicePageQueryDto;
import com.zzyl.entity.Device;
import com.zzyl.vo.DeviceDataGraphVo;
import com.zzyl.vo.DeviceVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface DeviceMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Device record);

    int insertSelective(Device record);

    Device selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Device record);

    int updateByPrimaryKey(Device record);

    /**
     * 这是Mybatis Generator拓展插件生成的方法(请勿删除).
     * This method corresponds to the database table device
     * @mbg.generated
     * @author hewei
     */
    int batchInsert(@Param("list") List<Device> list);
    @Select("select count(*) from device where device_name = #{deviceName}")
    Long countByDeviceName(String deviceName);
//分页查询
    Page<DeviceVo> selectByPage(DevicePageQueryDto devicePageQueryDto);
//条件查询
    DeviceVo selectByIotId(String iotId);
//按周查询
    List<DeviceDataGraphVo> queryDeviceDataListByWeek(@Param("iotId") String iotId, @Param("functionId") String functionId, @Param("of") LocalDateTime of, @Param("of1") LocalDateTime of1);
    //根据Id查询护理员的信息
    List<Long> selectNursingIdsByIotIdWithElder(String iotId);
    //根据Id查询床位信息
    List<Long> selectNursingIdsByIotIdWithBed(String iotId);

}